package cn.kinggm520.controller;

import cn.kinggm520.domain.Goods;
import cn.kinggm520.service.GoodsESService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * 作者: kinggm Email:731586355@qq.com
 * 时间:  2020-05-25 22:58
 */
@RestController
@RefreshScope // 开启刷新功能
public class GoodsController {



    @Autowired
    GoodsESService goodsESService;

    @PostMapping("/search")
    public List<Goods> findGoods(@RequestBody Map<String,String> param){
        List<Goods> list = null;
        try {
            list = goodsESService.findGoods(param);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return list;
    }
}
